package com.qianyucc.blog.model.vo;

import cn.hutool.core.bean.*;
import cn.hutool.core.bean.copier.*;
import com.qianyucc.blog.model.entity.*;
import com.qianyucc.blog.utils.*;
import lombok.*;

import static com.qianyucc.blog.global.Constants.DATE_TIME_PATTERN;

/**
 * @author lijing
 * @e-mail 1413979079@qq.com
 * @date 2020-02-06 18:21
 * @description 封装向前端返回的草稿信息
 */
@Data
public class DraftVO {
    public static DraftVO create(DraftDO draftDO){
        DraftVO draftVO = new DraftVO();
        BeanUtil.copyProperties(draftDO, draftVO, CopyOptions.create().ignoreError());
        draftVO.setGmtCreate(Utils.formatDate(draftDO.getGmtCreate(), DATE_TIME_PATTERN));
        draftVO.setGmtUpdate(Utils.formatDate(draftDO.getGmtUpdate(), DATE_TIME_PATTERN));
        return draftVO;
    }
    private String id;
    private String title;
    private String gmtCreate;
    private String gmtUpdate;
}
